import { createRouter, createWebHistory } from 'vue-router';
import routes from './routes';

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

router.beforeEach((to, from, next) => {
  // 可以在这里添加全局的路由导航逻辑
  next();
});

router.afterEach(() => {
  window.scrollTo(0, 0);
  // 在每次路由切换完成后，滚动页面到顶部
});

export default router;
